<template>
  <view class="complaint_warp">
    <template v-if="showType == 2">
      <create-complaint
        v-model="complaintForm"
        :imgNum="9"
        :typeList="typesList"
      ></create-complaint>
    </template>
    <template v-else>
      <view-complaint
        v-model="complaintForm"
        :dataInfo="complaintForm"
      ></view-complaint>
    </template>
  </view>
</template>

<script>
import createComplaint from "./components/create_complaint.vue";
import viewComplaint from "./components/view_complaint.vue";
import { getByStudent } from "../../api/index";
export default {
  components: {
    createComplaint,
    viewComplaint,
  },
  data() {
    return {
      showType: "",
      complaintForm: {
        type: "",
        desc: "",
        phone: "",
        imgs: [],
      },
      typesList: [
        {
          type: 2,
          type_name: "程序问题",
        },
        {
          type: 3,
          type_name: "订单问题",
        },
        {
          type: 4,
          type_name: "课程相关问题",
        },
        {
          type: 5,
          type_name: "退款问题",
        },
        {
          type: 6,
          type_name: "其他问题",
        },
      ],
    };
  },
  onLoad(options) {
    this.showType = options.type;
    this.complaintForm =JSON.parse(uni.getStorageSync("complaintInfo"));
    console.log(options.info, "this.complaintForm");
 
  },
  watch: {
    complaintForm: {
      deep: true,
      handler(news) {
        console.log(news, "complaintFormtt∂");
      },
    },
  },
  methods: {},
};
</script>

<style lang="scss">
.complaint_warp {
  width: 100vw;
  min-height: 100vh;
  background: #f5f6f9;
  padding: 24rpx 32rpx;
  padding-bottom: 60rpx;
  box-sizing: border-box;
}

.common_warp {
  width: 100%;
  border-radius: 12rpx;
  background-color: #fff;
  padding: 34rpx 24rpx 40rpx 24rpx;
  box-sizing: border-box;
  margin-bottom: 24rpx;
}

.common_title {
  color: #333;
  font-family: PingFang SC;
  font-size: 28rpx;
  font-style: normal;
  font-weight: bold;
  line-height: 28rpx;
  margin-bottom: 24rpx;
}
</style>
